package com.zl.spring.proxy;

import com.zl.spring.dao.LoginDao;
import com.zl.spring.dao.LoginDaoImpl;
import com.zl.spring.dao.UserDao;

import java.lang.reflect.Proxy;

public class JDKProxy {
    public static void main(String[] args) {

        Class[] interfaces = {LoginDao.class};

        LoginDaoImpl loginDao = new LoginDaoImpl();

        LoginDao dao = (LoginDao) Proxy.newProxyInstance(JDKProxy.class.getClassLoader(), interfaces, new LoginDaoProxy(loginDao));
        int add = dao.add(1, 2);
        System.out.println(add);

    }
}
